/*
 * @(#)XfplotActionListener.java        2003/01/01
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.xfplot.view.listener;

import xfuzzy.xfplot.view.Xfplot;
import java.awt.event.*;

/**
 * Controlador de eventos de acci�n de la ventana principal de Xfplot
 * 
 * @author Francisco Jos� Moreno Velo
 *
 */
public class XfplotActionListener implements ActionListener {
	
	//----------------------------------------------------------------------------//
	//                            MIEMBROS PRIVADOS                              //
	//----------------------------------------------------------------------------//

	/**
	 * Referencia a la ventana principal del entorno
	 */
	private Xfplot xfplot;
	
	//----------------------------------------------------------------------------//
	//                                CONSTRUCTOR                                 //
	//----------------------------------------------------------------------------//
	
	/**
	 * Constructor
	 */
	public XfplotActionListener(Xfplot xfplot) {
		this.xfplot = xfplot;
	}
		
 	//----------------------------------------------------------------------------//
	//                             M�TODOS P�BLICOS                               //
	//----------------------------------------------------------------------------//
	
	/**
	 * Interfaz ActionListener	
	 */
	public void actionPerformed(ActionEvent e) {
		String command = e.getActionCommand();
		if(command.equals("Plot")) xfplot.actualize();
		else if(command.equals("Actualize")) xfplot.actualize();
		else if(command.equals("XAxis")) xfplot.changeXAxis();
		else if(command.equals("YAxis")) xfplot.changeYAxis();
		else if(command.equals("ZAxis")) xfplot.changeZAxis();
		else if(command.equals("Samples")) xfplot.actualize();
		else if(command.startsWith("CM")) xfplot.changeColor(command);
		else if(command.equals("InputValues")) xfplot.changeInputValues();
		else if(command.equals("Close")) xfplot.close();
		else if(command.equals("SaveImage")) xfplot.saveImage();
		else if(command.equals("SaveData")) xfplot.saveData();
		else if(command.equals("SaveConfig")) xfplot.saveConfig();
		else if(command.equals("LoadConfig")) xfplot.loadConfig();
		else if(command.equals("2DPlot")) xfplot.set2DPlotMode();
		else if(command.equals("3DPlot")) xfplot.set3DPlotMode();
	}
	
}
